import storeUtil from "@pangza-club/utils/store";
import { NullAble } from "@pangza-club/utils/types";

export function getCurrentUser(): NullAble<LoginVO> {
    const user = storeUtil.get<NullAble<LoginVO>>('user') || null;
    return user;
}

export function isLogin(): boolean {
    const user = getCurrentUser();
    if(!user) return false;
    const token = user.token;
    if(!token) return false;
    else return true;
}

export function getToken() {
    const user = getCurrentUser();
    if(!user) return '';
    const token = user.token;
    if(!token) return '';
    else return token;
}